package com.auxgroup.hr.front.dao.repository;

import com.auxgroup.hr.front.dao.domain.PsJob;
import com.auxgroup.hr.front.dao.domain.PsJobPrimary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by nitongqian on 2019/1/18.
 */
@Repository
public interface PsJobRepository extends
        JpaRepository<PsJob,PsJobPrimary>,JpaSpecificationExecutor<PsJob> {

    List<PsJob> findByEmplid(String emplid);
    @Query(value = "FROM PsJob pj where pj.emplid = :emplid and pj.emplRcd = 0 and pj.action in ('HIR','REH')")
    List<PsJob> findJobs(@Param("emplid") String emplid);

    List<PsJob> findByEmplidAndEmplRcdOrderByEffdtDesc(String emplid, BigDecimal emplRcd);
}
